package com.aaa.os.controller;

import com.aaa.os.entity.TbOrder;
import com.aaa.os.service.TbOrderService;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * (TbOrder)表控制层
 *
 * @author makejava
 * @since 2021-01-11 17:16:28
 */
@RestController
@RequestMapping("order")
public class TbOrderController {
    /**
     * 服务对象
     */
    @Resource
    private TbOrderService tbOrderService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public TbOrder selectOne(Integer id) {
        return this.tbOrderService.queryById(id);
    }

//    @GetMapping("queryAll")
//    public List<TbOrder> queryAll(@RequestBody TbOrder tbOrder) {
//        return this.tbOrderService.queryAll(tbOrder);
//    }

    @GetMapping("queryAll")
    public List<TbOrder> queryAll() {
        List<TbOrder> tbOrders = this.tbOrderService.queryAll(null);
        TbOrder tbOrder=new TbOrder();
        tbOrder.setId(2221);
        tbOrder.setMemberUsername("当前节点为2221服务器。。。。");
        tbOrders.add(tbOrder);
        return tbOrders;
    }
}